package correct.day22;

import java.util.Scanner;

// 70%
public class Test1 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String str1 = in.next();
        String str2 = in.next();
        int len1 = str1.length();
        int len2 = str2.length();
        int min = Integer.MAX_VALUE;
        for (int i = 0; i <= len2 - len1; i++) {
            String s = str2.substring(i, len1 + i);
            int size = size(str1, s, len1);
            min = Math.min(min, size);
        }
        System.out.println(min);
    }

    public static int size(String s1, String s2, int len) {
        int count = 0;
        for(int i = 0; i < len; i++) {
            if(s1.charAt(i) != s2.charAt(i)) {
                count++;
            }
        }
        return count;
    }
}
